/*
 * total people is n, count until m, than exclude that people
 * restart from next position unitle all people found
 * (C) 2012 Sheng Yi
 */
#include <stdio.h>
void find_people(int a[], int n, int m);

int main()
{
	int a[10] = {0};
	find_people(a, 10, 3);
	return 0;
}

void find_people(int a[], int n, int m)
{
	int cnt = 0;
	int i, j = 0;
	for (i = 0; i < n; i++)
	{
		while (cnt < m)
		{
			if (j == n)
				j = 0;
			if (a[j] == -1)
			{
				j++;
				continue;
			}
			else
				cnt++;
			j++;
		}
		printf("people %d is excluded\n", j);
		a[j-1] = -1;
		cnt = 0;
	}
}
